﻿/*
Post-Deployment Script Template							
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be appended to the build script.		
 Use SQLCMD syntax to include a file in the post-deployment script.			
 Example:      :r .\myfile.sql								
 Use SQLCMD syntax to reference a variable in the post-deployment script.		
 Example:      :setvar TableName MyTable							
							 SELECT * FROM [$(TableName)]					
--------------------------------------------------------------------------------------
*/

USE [Cratos]
GO

-- Delete the relevant data
DELETE FROM [CratosUser]
GO

DELETE FROM [Person]
GO

DELETE FROM [Title]
DELETE FROM [UserStatus]
GO

-- Insert the relevant lookup data
SET IDENTITY_INSERT [Title] ON
INSERT INTO [Title] (Title_ID, Title_Name, Title_IsActive) VALUES (1, 'Mr', 1)
INSERT INTO [Title] (Title_ID, Title_Name, Title_IsActive) VALUES (2, 'Miss', 1)
INSERT INTO [Title] (Title_ID, Title_Name, Title_IsActive) VALUES (3, 'Mrs', 1)
SET IDENTITY_INSERT [Title] OFF
GO

SET IDENTITY_INSERT [UserStatus] ON
INSERT INTO [UserStatus] (UserStatus_ID, UserStatus_Name, UserStatus_IsActive) VALUES (1, 'Active', 1)
INSERT INTO [UserStatus] (UserStatus_ID, UserStatus_Name, UserStatus_IsActive) VALUES (2, 'Suspended', 1)
INSERT INTO [UserStatus] (UserStatus_ID, UserStatus_Name, UserStatus_IsActive) VALUES (3, 'Locked', 1)
SET IDENTITY_INSERT [UserStatus] OFF
GO

-- Insert the relevant Security data
SET IDENTITY_INSERT [Person] ON
INSERT INTO [Person]
	(Person_ID, Title_ID, Person_Initials, Person_Firstname, Person_Surname, Person_IsActive)
	VALUES (1, 1, 'A', 'Admin', 'Admin', 1)
SET IDENTITY_INSERT [Person] OFF
GO

SET IDENTITY_INSERT [CratosUser] ON
INSERT INTO [CratosUser]
	(CratosUser_ID, CratosUser_LogonName, UserStatus_ID, CratosUser_UseAD, CratosUser_Domain, CratosUser_Password, Person_ID, CratosUser_IsActive)
	VALUES (1, 'admin', 1, 0, null, 'admin', 1, 1)
SET IDENTITY_INSERT [CratosUser] OFF
GO
